<%@ taglib uri="/WEB-INF/c.tld" prefix="c-pt"
%><%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html-el-pt"
%>
<%@ page import="java.util.*"%>
<%@ page import="com.broadvision.web.util.ViewDynaBean" %>

<c-pt:if test="${pagetab != null}">

<table border="0" cellspacing="0" cellpadding="0" summary="Page sub tabs">
  <tr>
    <td>&nbsp;&nbsp;</td>
   <%int i=0; %> 

<c-pt:forEach var="item" items="${pagetab.items}">

<%

i++;
ViewDynaBean bean  = (ViewDynaBean)request.getAttribute("pager");

if(bean!=null){
Map map2 = (Map) bean.getMap();

//System.out.println("size: "+ map.size());

Set s = map2.keySet();
String attr="";
Iterator it2 = s.iterator();
while(it2.hasNext()){
attr=it2.next().toString();
  //  out.println("attribute: "+attr+"");
}

//out.println("map---"+ map2.get("urlParams"));



java.util.HashMap urlParams = (java.util.HashMap)map2.get("urlParams");


if(urlParams.get("channelId")!=null){

String channelId = urlParams.get("channelId").toString();



if(channelId.length()<1){
	
	channelId="0";
	
};

pageContext.setAttribute("channelId",channelId);


}else{
	pageContext.setAttribute("channelId","0");
}

}
%>


  <c-pt:if test="${item.visible}">

    <c-pt:if test="${!item.enabled}">

    <td>&nbsp;</td>
    <td class="pageSubTabDisable">&nbsp;</td>
    <td align="center" class="pageSubTabDisable">
      <c-pt:out value="${item.name}"/>
    </td>
    <td class="pageSubTabDisable">&nbsp;</td>

    </c-pt:if>

    <c-pt:if test="${item.enabled}">

    <c-pt:set var="tabClass">pageSubTabOff</c-pt:set>
    <c-pt:if test="${item.selected}">
    <c-pt:set var="tabClass">pageSubTabOn</c-pt:set>
    </c-pt:if>

    <td>&nbsp;</td>
    <td class="<c-pt:out value="${tabClass}"/>">&nbsp;</td>
    <td align="center" class="<c-pt:out value="${tabClass}"/>">
      <c-pt:if test="${empty item.onclick}">
        <c-pt:if test="${pagetabParam == null}">
        
     

        <html-el-pt:link page="${item.path}.do?channelId=${channelId}"><c-pt:out value="${item.name}"/></html-el-pt:link>
        </c-pt:if>
        <c-pt:if test="${pagetabParam != null}">
 		<html-el-pt:link page="${item.path}.do" name="pagetabParam"><c-pt:out value="${item.name}"/></html-el-pt:link>
        </c-pt:if>
   
      </c-pt:if>
      <c-pt:if test="${not empty item.onclick}">
        <c-pt:if test="${empty item.path}">
        <a href="#" onclick="<c-pt:out value="${item.onclick}"/>"><c-pt:out value="${item.name}"/></a>
        </c-pt:if>
        <c-pt:if test="${not empty item.path}">
          <c-pt:if test="${pagetabParam == null}">
          <html-el-pt:link page="${item.path}.do" onclick="${item.onclick}"><c-pt:out value="${item.name}"/></html-el-pt:link>
          </c-pt:if>

          <c-pt:if test="${pagetabParam != null}">
        
          </c-pt:if>
        </c-pt:if>
      </c-pt:if>
    </td>
    <td class="<c-pt:out value="${tabClass}"/>">&nbsp;</td>

    </c-pt:if>

  </c-pt:if>

</c-pt:forEach>

<%//out.println("page tab #: "+ i); %>

  </tr>
</table>

<div class="subTab"></div>
<!-- end of PageTab -->

</c-pt:if>